package com.ketangpai.admin.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ketangpai.admin.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


@Mapper
public interface UserMapper extends BaseMapper<User> {
    //查询
    @Select("select * from user where account=#{account}")
    User findByUserName(String account);

    @Insert("INSERT INTO user(account, password, phone, name, school, type) " +
            "VALUES (#{account}, #{password}, #{phone}, #{name}, #{school}, #{type})")
    void add(User user);

    @Select("select * from user where phone=#{phone}")
    User findByPhone(String phone);

    @Select("select * from user where id=#{id}")
    User selectById(Integer userId);

}
